package com.umeox.watch.moto.gallery.db.dao;

/**
 * Created by Rambo 2021/10/18
 * Describe:
 */

import android.database.Cursor;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.umeox.watch.moto.gallery.db.model.AlbumInfo;

import java.util.List;

@Dao
public interface AlbumInfoDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long save(AlbumInfo albumInfo);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void save(List<AlbumInfo> albumInfos);

    @Delete
    int delete(AlbumInfo albumInfo);

    @Delete
    void delete(List<AlbumInfo> albumInfos);


    @Query("DELETE FROM gallery_info")
    int deleteAll();

    @Query("SELECT * FROM gallery_info")
    Cursor query();

    @Query("SELECT * FROM gallery_info WHERE image_path =:imagePath")
    AlbumInfo queryByImagePath(String imagePath);


}
